package com.ywb.prototype;

import java.awt.*;

/**
 * @Author ywb
 */
public class Client {
    public static void main(String[] args) {
//        传统方式创建5只羊
        Sheep sheep = new Sheep("dolly", 10, new Color(2555,255,255), new Sheep("sb",5, null,null));
        Sheep sheep2 = new Sheep("dolly", 10, new Color(2555,255,255), new Sheep("sb",5, null,null));
        Sheep sheep3 = new Sheep("dolly", 10, new Color(2555,255,255), new Sheep("sb",5, null,null));
        Sheep sheep4 = new Sheep("dolly", 10, new Color(2555,255,255), new Sheep("sb",5, null,null));
        Sheep sheep5 = new Sheep("dolly", 10, new Color(2555,255,255), new Sheep("sb",5, null,null));

//        原型模式
        sheep2 = (Sheep) sheep.clone();
        sheep3 = (Sheep) sheep.clone();
        sheep4 = (Sheep) sheep.clone();
        sheep5 = (Sheep) sheep.clone();
//       序列话深拷贝
        sheep2 = (Sheep) sheep.deepClone();
        sheep3 = (Sheep) sheep.deepClone();
        sheep4 = (Sheep) sheep.deepClone();
        sheep5 = (Sheep) sheep.deepClone();

    }
}
